<template>
	<view class="banner_index">
		<view class="top_banner">
			<view class="user_info">
				<view @click="userInfoHandle" class="info_img">
					<image class="avatar" :src="userInfo.avatar" mode=""></image>
				</view>
				<view class="title">
					曼德呵护
				</view>
				<view @click="connectHandle" class="info">
					<view class="text_info">
						您还不是会员，点击加入会员
						<image :src="goLog"></image>
					</view>
				</view>
			</view>

			<view class="under_info">
				<view class="concat">
					微信公众号：曼德呵护科技
				</view>
				<view class="phone">
					联系方式：{{photoNumber}}
					<image @click="handlePhone" :src="phototLog"></image>
				</view>
			</view>
			<view v-if="itemData.length" class="content">
				<view class="container_item">
					<ul>
						<li @click="handleSwitch(item,index)" v-for="(item,index) in itemData">
							<view :class="highLight===index?'avtive_li':''"> {{item}}</view>
						</li>
					</ul>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import goLog from '@/pages/tabBar/static/images/user/go.png'
	import phototLog from '@/pages/tabBar/static/images/phoneconcat.png'
	import {
		mapGetters
	} from "vuex";
	export default {
		data() {
			return {
				goLog: goLog,
				phototLog: phototLog,
				photoNumber: '69084681',
			}
		},
		computed: mapGetters(['isLogin', 'uid', 'userInfo']),
		props: {
			itemData: {
				type: Array,
				default: () => ([])
			},
			highLight: {
				type: Number,
				default: 0
			}
		},
		methods: {
			handlePrefix() {
				uni.scanCode({
					success: (res) => {
						uni.showToast({
							title: '扫描结果为' + JSON.stringify(res)
						})
					},
					fail: (res) => {
						uni.showToast({
							title: '错误：' + JSON.stringify(res)
						})
					}
				})
			},
			connectHandle() {
				wx.showToast({title:'模块建设中',icon:'none'})
				// uni.navigateTo({
				// 	url: '/pages/user/member/member'
				// })
			},
			handlePhone() {
				uni.makePhoneCall({
					phoneNumber: this.photoNumber,
					success: (res) => {
					},
					fail: (res) => {
					}
				})
			},
			userInfoHandle() {
				uni.navigateTo({
					url: '/pages/user/user_info/user_info'
				})
			},
			handleSwitch(item, index) {
				this.$emit('sendNum', index);
			},
		},
	}
</script>

<style lang="scss" scoped>
	.banner_index {
		background-color: rgb(240, 242, 245);

		.top_banner {
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			gap: 10rpx;
			width: 100%;
			background-size: cover;
			padding: 20rpx;
			background-repeat: no-repeat;
			background-image: url();

			.user_info {
				display: flex;
				justify-content: flex-start;
				align-items: center;
				position: relative;

				.info_img {
					margin: 0 20rpx 0 0;

					.avatar {
						width: 50rpx;
						height: 50rpx;
						border-radius: 50%;
					}
				}

				.title {
					color: #F86853;
					font-size: 45rpx;
					font-weight: 500;
				}

				.info {
					position: absolute;
					right: 10rpx;
					top: 20rpx;
					display: flex;
					justify-content: flex-end;
					align-items: center;

					.text_info {
						color: rgb(44, 43, 40);
						font-size: 20rpx;
						margin-right: 10rpx;

						image {
							margin-left: 20rpx;
							width: 30rpx;
							height: 30rpx;

						}
					}

					.image_info {
						image {
							border-radius: 50%;
							width: 60rpx;
							height: 60rpx;
						}
					}


				}
			}

			.ipt_index {
				margin: 20rpx 0;


				.ipt .el-input__prefix .el-input__icon {
					font-weight: bolder;
				}

				.ipt {
					border: 1px solid rgb(251, 174, 163);
					border-radius: 60rpx;
				}

			}

			.under_info {
				-webkit-column-width: 100%;
				font-size: 26rpx;
				color: rgb(149, 148, 148);
				display: flex;
				justify-content: space-between;
				padding: 20rpx 20rpx;
				align-items: center;

				.concat {}

				.phone {
					display: flex;
					align-items: center;

					image {
						margin-left: 20rpx;
						width: 30rpx;
						height: 30rpx;
					}
				}
			}




		}

		.content {
			background-color: #fff8f9;
			margin: 20rpx auto;
			width: 100%;
			border-radius: 20rpx;

			.container_item {
				ul {
					display: flex;
					justify-content: center;
					align-items: center;

					li {
						text-align: center;
						position: relative;
						margin: 0 20rpx;
						padding: 10rpx 0;

						view {
							padding: 10rpx 0;
						}

					}

					.active_li {
						padding-top: 10rpx;
					}

					// .btn_line {
					// 	position: absolute;
					// 	bottom: 10rpx;
					// 	left: 0;
					// 	content: '';
					// 	width: 100%;
					// 	height: 6rpx;
					// }

					.avtive_li {
						color: #fb6853;
						border-bottom: 2px solid #fb6853;
					}

					.active_line {
						background-color: #fb6853;
					}
				}
			}
		}
	}
</style>